﻿using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel.DataAnnotations;
using CodeContrib;
using CodeContrib.Data.Entity;

namespace CodeContribBlog.Data
{
	[MetadataType(typeof (BlogMetadata))]
	public class Blog : Entity
	{
		private string _slug;

		public string AkismetKey { get; set; }
		public string Copyright { get; set; }
		public User Creator { get; set; }
		public string MetaDescription { get; set; }
		public int MinimumNumberOfPostsForSignificantTag { get; set; }
		public int NumberOfDaysToComment { get; set; }
		public ICollection<Post> Posts { get; set; }

		public string Slug
		{
			get { return _slug; }
			set { _slug = value.ToSlug(); }
		}

		public string Subtitle { get; set; }
		public string Title { get; set; }
		public string Url { get; set; }

		public Blog()
		{
			Posts = new Collection<Post>();
		}
	}
}